<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('messages', function (Blueprint $table) {
            $table->increments('id')->unsigned()->comment('消息表');
            $table->integer('user_id')->unsigned()->comment('用户id');
            $table->string('title')->nullable()->comment('标题');
            $table->string('content')->nullable()->comment('内容');
            $table->enum('type', ['sys', 'order'])->default(\App\Models\Message::SYS)->comment('消息类型 系统消息sys 订单消息order');
            $table->string('remarks')->nullable()->comment('备注');
            $table->boolean('is_read')->default(false)->comment('是否已读');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('messages');
    }
}
